// Copyright 2007-2008 Rory Plaire (codekaizen@gmail.com)

using System;

namespace NPack.Interfaces
{
    /// <summary>
    /// An interface to a matrix used to model systems numerically.
    /// </summary>
    /// <typeparam name="T">Type of element in the matrix.</typeparam>
    public interface INumericalMatrix<T> : IMatrix<T>
        where T : IEquatable<T>, IComparable<T>, IComputable<T>, IConvertible
    {
        /// <summary>
        /// Gets the Frobenius norm for the matrix.
        /// </summary>
        /// <value>
        /// The square root of sum of squares of all elements.
        /// </value>
        Double FrobeniusNorm { get; }

        /// <summary>
        /// Gets the infinity (or max) norm for the matrix.
        /// </summary>
        /// <value>
        /// The maximum row sum.
        /// </value>
        Double InfinityNorm { get; }

        /// <summary>
        /// Gets the 1 norm for the matrix.
        /// </summary>
        /// <value>
        /// The maximum column sum.
        /// </value>
        Double Norm1 { get; }

        /// <summary>
        /// Gets the trace of the matrix.
        /// </summary>
        /// <returns>
        /// Sum of the diagonal elements.
        /// </returns>
        Double Trace { get; }

        /// <summary>
        /// Returns a matrix which is the solution to the 
        /// <paramref name="b">given matrix</paramref>, if one exists.
        /// </summary>
        /// <param name="b">Matrix to solve this linear system for.</param>
        /// <returns>The solution, x, to the equation <c>Ax = B</c>, where the 
        /// <see cref="NumericalMatrix{T}"/> is the "A" matrix and the <paramref name="b"/>
        /// parameter is B.</returns>
        IMatrix<T> Solve(IMatrix<T> b);
    }
}